//
//  SAStageObjectRenderer.h
//  GameFrame
//
//  Created by Hiroshi Nomura on 2013/11/11.
//  Copyright (c) 2013年 Hiroshi Nomura. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef struct _ShaderProgram ShaderProgram;

typedef enum _VERTEX_ATTRIB_IDX{
	VERTEX_ATTRIB_IDX_VERTEX,
	VERTEX_ATTRIB_IDX_NORMAL,
	VERTEX_ATTRIB_IDX_TEXTURECOORD0,
    VERTEX_ATTRIB_IDX_TEXTURECOORD1,
	VERTEX_ATTRIB_IDX_WEIGHTMAP,
	VERTEX_ATTRIB_IDX_JOINTIDX,
	VERTEX_ATTRIB_IDX_SIZE
}VERTEX_ATTRIB_IDX;

@interface SAStageObjectRenderer : NSObject

- (id) initWithContext:(EAGLContext*)context andDrawable:(id<EAGLDrawable>)drawable;
- (GLuint) buildShaderProgramWithVertexShader:(NSString*)vpath ofVType:(NSString*)vtype
                               FragmentShader:(NSString*)fpath ofFType:(NSString*)ftype
                                   withNormal:(BOOL)hasNormal withTexture:(BOOL)hasTexture withSkeleton:(BOOL)hasSkeleton;
- (ShaderProgram*) registerShaderProgram:(GLuint)program
			  withVertexUniformNameArray:(NSArray*)vtxUniformArray
			 andFragmentUniformNameArray:(NSArray*)frgUniformArray;
-(void)destroyProgram:(ShaderProgram*) shaderProgram;

- (void) render:(ShaderProgram*)shaderProgram viewMatrix:(Matrix4x4*)viewMatrix objects:(NSArray*)objectArray;
- (GLuint)getViewWidth;
- (GLuint)getViewHeight;

@end
